package com.community.service.impl;

import com.community.mapper.AnnouncementMapper;
import com.community.pojo.Announcement;
import com.community.service.AnnouncementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AnnouncementServiceImpl implements AnnouncementService {
    private final AnnouncementMapper announcementMapper;
    @Autowired
    AnnouncementServiceImpl(AnnouncementMapper announcementMapper) {
        this.announcementMapper = announcementMapper;
    }



    @Override
   public Announcement findAnnouncementById(Integer announcementId) {
      Announcement announcement= announcementMapper.findAnnouncementById(announcementId);
       return announcement;
    }
    public List<Announcement> findAllAnnouncement(){
        return announcementMapper.findAllAnnouncement();
    }

   public int addAnnouncement(Announcement announcement){
        return announcementMapper.addAnnouncement(announcement);
    }
    public int deleteAnnouncementById(Integer announcementId){
        int n= announcementMapper.deleteAnnouncementById(announcementId);
        return n;
    }

    public int updateAnnouncement(Announcement announcement){
        int n= announcementMapper.updateAnnouncement(announcement);
        return n;
    }
}
